/*
 * STMTest3.c
 *
 *  Created on: May 25, 2013
 *      Author: koldar
 */

#include <stdio.h>
#include <stdlib.h>
#include "graph.h"
#include "solution.h"
#include "tabooState.h"
#include "graphbmp-tools.h"
#include "parser.h"

int main(int argn, const char** args){
	FILE* graphFile;
	Pgraph pgraph;
	Psolution psolution;
	PtabooState ptaboostate;
	int N;
	int K;
	if (argn==3){
		graphFile = fopen(args[1],"r");
		K = atoi(args[2]);
	}else{
		printf("numero di parametri passati errati.\n");
		return EXIT_FAILURE;
	}
	pgraph = parseGraph(graphFile, &N);
	dijkstraFiller(pgraph);
	initSmartWeights(pgraph);
	psolution = initSolution(&K, &N);
	ptaboostate = initTabooState(&N, &K, 0);

	buildSimpleConstructive(pgraph,psolution,ptaboostate);

	/*printSolution(stdout,psolution);
	drawSolutionFromScratch(
					"test.bmp",
					psolution,
					pgraph->depot,
					15,
					15,
					7,
					1,
					4,
					2,
					1,
					COLOR_BLACK,
					COLOR_DARK_GREY,
					COLOR_VIOLET);*/
	initSTMEngine(pgraph->T,pgraph->Q);
	//WATCHME per togliere la stampa script matlab, mettere a false gli ultimi due
	executeSTM(psolution, pgraph, ptaboostate, 200, 5, false, true, true);

	printf("FINE.\n");

	return 0;
}
